package co.rcantor.dev.siasar;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class SIASARActivity extends Activity {
	
	Intent intent = null;	

	@Override
	public void onCreate(Bundle savedInstanceState) {
	  super.onCreate(savedInstanceState);
	  
	  setContentView(R.layout.main);
	  
	  String[] FORMULARIOS = getResources().getStringArray(R.array.main_list_1);
	  String[] ACCIONES = getResources().getStringArray(R.array.main_list_2);
	  String[] AYUDA = getResources().getStringArray(R.array.main_list_3);
	  
	  ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, FORMULARIOS);
	  ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, ACCIONES);
	  ArrayAdapter<String> adapter3 = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, AYUDA);
	  
	  ListView list1 = (ListView)findViewById(R.id.main_1);
	  ListView list2 = (ListView)findViewById(R.id.main_2);
	  ListView list3 = (ListView)findViewById(R.id.main_3);	  
	  
	  list1.setAdapter(adapter1);	  
	  list2.setAdapter(adapter2);
	  list3.setAdapter(adapter3);
	  
//	  list1.setTextFilterEnabled(true);
	  
	  list1.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			switch (position){
				case 0:
					System.out.println("presionado 0");
					Toast.makeText(SIASARActivity.this, "f1 presionado", Toast.LENGTH_LONG).show();
					break;
				case 1:
					System.out.println("presionado 1");
					Toast.makeText(SIASARActivity.this, "f2 presionado", Toast.LENGTH_LONG).show();
					break;
				case 2:
					System.out.println("presionado 2");
					Toast.makeText(SIASARActivity.this, "f3 presionado", Toast.LENGTH_LONG).show();
					break;
				case 3:
					System.out.println("presionado 3");
					Toast.makeText(SIASARActivity.this, "f4 presionado", Toast.LENGTH_LONG).show();
					break;					
			}
			
		}
	  });
	  
	  list1.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				// TODO Auto-generated method stub
				
			}
	  });
	  
	  list1.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				// TODO Auto-generated method stub
				
			}
	  });
	  
	}
}